package showtime.framework.algorithm.collections
{
	import flash.utils.Dictionary;
	
	
	/** 
	 * Description: Simple hash map.
	 * 
	 * @project showtime
	 * @author yinhao
	 * @date 2011-2-24
	 *
	 */
	
	public class HashMap
	{
		public var map:Dictionary = null;

		public function HashMap()
		{
			map = new Dictionary(true);			
		}
		
		public function put(key:*, value:*):void
		{
			map[key] = value;
		}
		
		public function remove(key:*):void
		{		
			delete map[key];
		}
		
		public function containsKey(key:*):Boolean
		{
			return map[key] != null;
		}
		
		public function getValue(key:*):*
		{
			return map[key];
		}
		
		public function getValues():Array
		{
			var valueList:Array = [];
			
			for (var key:* in map)
			{
				valueList.push(map[key]);
			}
			
			return valueList;
		}
		
		public function getKeys():Array
		{
			var keyList:Array = [];
			
			for (var key:* in map)
			{
				keyList.push(key);
			}
			
			return keyList;
		}
	}
}